# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ktorrent
pkgver=5.2.0
pkgrel=1
arch="all !ppc64le !s390x !armhf" # Limited by plasma-workspace -> libksysguard -> qt5-qtwebengine
arch="$arch !mips !mips64" # Limited by libktorrent
url="https://kde.org/applications/internet/org.kde.ktorrent"
pkgdesc="A powerful BitTorrent client for KDE"
license="GPL-2.0-or-later"
makedepends="extra-cmake-modules qt5-qtbase-dev kconfig-dev kconfigwidgets-dev
	kcoreaddons-dev kcrash-dev kdbusaddons-dev ki18n-dev kiconthemes-dev
	kio-dev knotifications-dev knotifyconfig-dev kcmutils-dev kparts-dev
	solid-dev kwidgetsaddons-dev kwindowsystem-dev kxmlgui-dev kdoctools-dev
	libktorrent-dev boost-dev ktextwidgets-dev karchive-dev kitemviews-dev
	kross-dev kplotting-dev syndication-dev kdewebkit-dev kdnssd-dev
	kcompletion-dev plasma-workspace-dev taglib-dev phonon-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/ktorrent/$pkgver/ktorrent-$pkgver.tar.xz
	0001-Update-FindTaglib-from-ECM.patch"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	# The infowidget plugin is disabled due to an incompatibility with musl
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DENABLE_INFOWIDGET_PLUGIN=FALSE
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="141976612cfe6bf4bd06e96842d7bc51ced7a3ab8e13c25446a00c031054698f851fbb1a31f3425dda5a428408bb1ceb51a4a420eaf2e79193b17a0cc7d7a387  ktorrent-5.2.0.tar.xz
8964c426bd554e6619400582589002d4d1fc731e65faaae7ad300db443b2686c57d0eb940183d9f445202e5be67063b1e4fca2ac115c2be78cb88b88f0022b79  0001-Update-FindTaglib-from-ECM.patch"
